package com.headfirst.factory.abstractfactory.pizza;

import com.headfirst.factory.abstractfactory.ingredientfactory.PizzaIngredientFactory;

public class CheesePizza extends Pizza{
    
    private PizzaIngredientFactory ingredientFactory;

    public CheesePizza(PizzaIngredientFactory ingredientFactory) {
        this.ingredientFactory = ingredientFactory;
    }

    /**
     * 制作Pizza的原料，不同地区的原料通过不同地区的原料工厂取得。
     */
    @Override
    public void prepare() {
        System.out.println("Preparing "+super.getName());
        super.setDough(ingredientFactory.createDough());
        super.setSauce(ingredientFactory.createSauce());
        super.setCheese(ingredientFactory.createCheese());
    }
}
